<?php
class WCoreWidget extends CWidget
{
	/**
    * Override the render method to automiatically return or render HTML result
    * in case of rendering widget for layout or template
    *
    * @param mixed $view
    * @param mixed $data
    * @return string
    */
    public function render($view, $data=array())
	{
        return parent::render($view, $data, TRUE);
    }

    /**
    * define form in widget after postback
    */
    public function defineWidgetFormAfterPostBack($widgetId, $formId, $serviceId, $submitName)
	{
    	$request = Yii::app()->request;
        if ($request->isPostRequest && !$request->isAjaxRequest
		&& $widgetId == $request->getPost('WIDGET_ID') && $formId == $request->getPost('FORM_ID') && $serviceId == $request->getPost('SERVICE_ID') && isset($_POST[$submitName])) {
			return true;
        }
        return false;
	}
}
?>